// 验证码
function fn() {
    $.ajax({
        type: 'get',
        url: 'http://47.94.4.201/index.php/index/index/getcode',
        data: {},
        dataType: 'json',
        success: (a) => {
            var b = document.querySelector('.num')
            b.innerHTML = a.msg
        },
        error: e => {
            console.log(e);
        }
    })
}

// 登录
function loge() {
    $.ajax({
        type: 'post',
        url: 'http://47.94.4.201/index.php/index/index/login',
        data: {
            name: $('#user_name').val(),
            pwd: $('#password').val(),
            vercode: $('#yzm').val(),
        },
        dataType: 'json',
        success: (a) => {
            if (a.msg == '登录信息') {
                localStorage.setItem('loog',JSON.stringify($('#user_name').val()))
                location.assign('../首页/首页.html')
            } else {
                alert('登录失败,用户名或密码错误')
                location.reload(true)
            }
        },
        error: e => {
            console.log(e);
        }
    })
    console.log();
}